﻿<table width="100%" cellpadding="0" cellspacing="0">
	<form action="index.php" method="post" name="frm_agency">
	<input name="fuseaction" type="hidden" value="">
	<input type="hidden" name="agency_id" value="<?php echo $v_agency_id;?>">
	<tr><td height="5"></td></tr><?php 
	$v_number_of_cate = sizeof($arr_all_cate);
	$v_agency_name= $arr_all_cate['0']['0'];
	$v_agency_id= $arr_all_cate['0']['3'];
	
	?>
		<tr class="page_title">
			<td colspan="3"><?php echo CONST_AF_SEARCH_BY_AGENCY_LABEL." >> ".$v_agency_name." (".$v_total_af.")"; ?></td>
		</tr>
		
		<tr><td height="20"></td></tr>
		<tr >
			<td class="normal_label" align="left" ><?php echo CONST_AGENCY_SELECT_LABEL; ?></td>
			<td class="normal_label" align="left" >
			  <select name="sel_author" class="normal_selectbox" onChange="show_page_cate_by_agency_onChange();">                
                <?php echo _generate_select_option($arr_all_agency,"0","0","1", $v_agency_id);?>
              </select></td>			
		</tr>		
		<tr><td height="20"></td></tr><?php			
			$current_pos=0; // vi tri hien thoi 
					//So vong lap de lay danh sach linh vuc con
					$total_loop= $v_number_of_cate;
					$haft_loop= round($total_loop/2); // mot nua vong lap
					for($i=0;$i< $haft_loop;$i++){//(****)
						$j= $current_pos + $i; // vi tri lay linh vuc
						// day linh vuc ben trai
						$v_left_category_id = $arr_all_cate[$j]['1'];
						$v_left_category_name= $arr_all_cate[$j]['2'];	
						$v_left_number_af=$arr_all_cate[$j]['4'];					
						$v_left_category_url = "index.php?fuseaction=DISPLAY_ALL_AF_BY_CATE&v_session=".$v_session."&category_id=" . $v_left_category_id . "&agency_id=".$v_agency_id;
						// day linh vuc ben phai
						$right_index= $j+ $haft_loop;  // vi tri lay linh vuc o day ben phai
						if(($right_index- $current_pos) < $total_loop){
							$v_right_category_id = $arr_all_cate[$right_index]['1'];
							$v_right_category_name = $arr_all_cate[$right_index]['2'];
							$v_right_number_af=$arr_all_cate[$right_index]['4'];						
							$v_right_category_url = "index.php?fuseaction=DISPLAY_ALL_AF_BY_CATE&v_session=".$v_session."&category_id=" . $v_right_category_id . "&agency_id=".$v_agency_id;
						}?>
					
					<tr class="category_on_list_page"> 
					<col width="42%"><col width="43%"><col width="15%">
						<td>
						<img src="<?php echo $_ISA_IMAGE_URL_PATH?>open.gif" class="l_image">
							<a class="category_on_list_page" href="<?php echo $v_left_category_url;?>"><?php echo $v_left_category_name;?></a><? echo " (".$v_left_number_af.")";?>
						</td><?php
						if(($right_index- $current_pos) < $total_loop){?>	
							<td>
							<img src="<?php echo $_ISA_IMAGE_URL_PATH?>open.gif" class="l_image">
								<a class="category_on_list_page" href="<?php echo $v_right_category_url;?>"><?php echo $v_right_category_name;?></a><? echo " (".$v_right_number_af.")";?>
							</td><?php
						}?>	
						<td></td>
					</tr><?php 
				}//(****)
				$current_pos= $current_pos + $total_loop; ?>
				
	<tr><td height="200"></td></tr>
</form>	
</table>
<table width="100%" cellpadding="0" cellspacing="0">
	<tr><td>&nbsp;</td></tr>
	<tr>
		<td align="center"><a class="normal_button" href="<?php echo $_URL_BACK?>"><?php echo _CONST_BACK_BUTTON; ?></a>
		<!--<a class="large_button" href="<? //echo _CONST_VTVNET_URL_PATH; ?>"><?php //echo _CONST_VTV_GO_HOME; ?></a>-->
		</td>
	</tr>
</table>
